<?
	require_once("../cBasic/950cons.php");
	$recid=$_GET['recid'];
	$aColumnsValue=array();
	
	$sQuery="select  SkillID from req_skill where ReqID=".$recid." and Status=1";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$aColumnsValue[] = $aRow['SkillID'];
	}
	
	$output = array();
	$output['title'] = array('skID','skCode','skName','YoR');
	$output["aaData"] = array();
	$sQuery="select skID, skCode, skName from skill where Status=1 order by skName asc";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	while ( $aRow = mysql_fetch_array( $rResult ) ){
		$output["aaData"][] = array($aRow['skID'], $aRow['skCode'], $aRow['skName'],'0');
	}
	
	for ($x=0;$x<count($aColumnsValue);$x++){
		for ($y=0;$y<count($output["aaData"]);$y++){
			if ($aColumnsValue[$x]==$output["aaData"][$y][0]){
				$output["aaData"][$y][3]='1';
			}
		}
	}
	
	mysql_close($con);
	
	echo json_encode($output);
?>